package nl.grol.yakshop.domain.model;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.Inheritance;
import javax.jdo.annotations.InheritanceStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public class BaseOrder {
	
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
    
    @Persistent
    private Integer forDay;
	
    @Persistent
	private String customerName;

    @Persistent
    private Double milkInLiters;
	
    @Persistent
    private Integer skins;
	
    @Persistent
    private Date receiptDate;
	
	protected BaseOrder(Integer forDay, String customerName, Double milkInLiters, Integer skins, Date receiptDate) {
		super();
		this.receiptDate = new Date();
		this.forDay = forDay;
		this.customerName = customerName;
		this.milkInLiters = milkInLiters;
		this.skins = skins;
		this.receiptDate = receiptDate;
		if( this.receiptDate == null ) {
			this.receiptDate = new Date(); // now
		}
	}
	
	public Key getKey() {
		return key;
	}
	
	public Integer getForDay() {
		return forDay;
	}

	public Date getReceiptDate() {
		return receiptDate;
	}

	public String getCustomerName() {
		return customerName;
	}

	public Double getMilkInLiters() {
		return milkInLiters;
	}

	public Integer getSkins() {
		return skins;
	}
	
	

}
